package com.assistant.codegen.modules.model.domain;

import com.assistant.codegen.modules.template.domain.CodeStyle;
import com.assistant.framework.BaseDomain;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import javax.persistence.*;
import java.util.List;

/**
 * 项目
 */
@EqualsAndHashCode(callSuper = true)
@ToString(exclude = "models")
@Data
@Entity
@Table(name = "codegen_project_project")
public class Project extends BaseDomain<Project> {

    /**
     * 项目名称
     */
    private String name;

    /**
     * 项目包名
     */
    private String packageName;

    /**
     * 采用的代码风格
     */
    @ManyToOne
    @JoinColumn(name = "codestyle_id", foreignKey = @ForeignKey(name = "none"))
    private CodeStyle codeStyle;

    /**
     * 使用的数据源
     */
    @ManyToOne
    @JoinColumn(name = "datasource_id", foreignKey = @ForeignKey(name = "none"))
    private DataSource dataSource;

    /**
     * 使用的数据库
     */
    private String databaseName;

    /**
     * 拥有的领域模型
     */
    @OneToMany
    @JoinColumn(name = "project_id", foreignKey = @ForeignKey(name = "none"))
    private List<Model> models;
}

